# Copyright (c) 2021 Huayun Inc.
# hostha is licensed under Mulan PSL v2.
# You can use this software according to the terms and conditions of the
# Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
#          http://license.coscl.org.cn/MulanPSL2
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.


WSGI_APP_CALLBACK = "callback"
WSGI_APP_CLOUDULTRA = "hostha"

STATE_OK = "OK"
STATE_ALARM = "ALARM"
STATE_INSUFFICIENT_DATA = "INSUFFICIENT_DATA"

COMPARISON_GE = "GreaterThanOrEqualToThreshold"
COMPARISON_GT = "GreaterThanThreshold"
COMPARISON_LE = "LessThanOrEqualToThreshold"
COMPARISON_LT = "LessThanThreshold"

STATISTICS_COUNT = "SampleCount"
STATISTICS_AVERAGE = "Average"
STATISTICS_SUM = "Sum"
STATISTICS_MIN = "Minimum"
STATISTICS_MAX = "Maximum"

ITEM_CONFIG_UPDATE = "ConfigurationUpdate"
ITEM_STATE_UPDATE = "StateUpdate"
ITEM_ACTION = "Action"

ACTION_TYPE_EMAIL = "email"
ACTION_TYPE_HTTP = "http"
ACTION_TYPE_MESSAGE = "message"

ALARM_LEVEL_LOW = "LOW"
ALARM_LEVEL_MEDIUM = "MEDIUM"
ALARM_LEVEL_HIGH = "HIGH"

ORDER_ASC = "asc"
ORDER_DESC = "desc"

SCHEDULE_ACTION_VOLUME_SNAPSHOT = "VolumeSnapshot"
SCHEDULE_ACTION_INSTANCE_SNAPSHOT = "InstanceSnapshot"
SCHEDULE_HISTORY_ITEM_VOLUME_SNAPSHOT_CREATE = "VolumeSnapshotCreate"
SCHEDULE_HISTORY_ITEM_VOLUME_SNAPSHOT_DELETE = "VolumeSnapshotDelete"
SCHEDULE_HISTORY_ITEM_INSTANCE_SNAPSHOT_CREATE = "InstanceSnapshotCreate"
SCHEDULE_HISTORY_ITEM_INSTANCE_SNAPSHOT_DELETE = "InstanceSnapshotDelete"
SCHEDULE_HISTORY_ITEM_CONFIG_UPDATE = "ConfigurationUpdate"

SCHEDULE_MIN_INTERVAL = 60

SCHEDULER_PUBLISHER_ID = "scheduler"

EVENT_SCHEDULE_EXECUTION = "schedule.execution"

HTTP_METHOD_GET = "GET"
HTTP_METHOD_PUT = "PUT"
HTTP_METHOD_POST = "POST"
HTTP_METHOD_PATCH = "PATCH"
HTTP_METHOD_DELETE = "DELETE"
HTTP_METHOD_HEAD = "HEAD"

ALARM_LEVEL_TEXT_MAP = {
    '1': ALARM_LEVEL_LOW,
    '2': ALARM_LEVEL_MEDIUM,
    '3': ALARM_LEVEL_HIGH
}

ALARM_TEXT_LEVEL_MAP = {
    ALARM_LEVEL_LOW: '1',
    ALARM_LEVEL_MEDIUM: '2',
    ALARM_LEVEL_HIGH: '3'
}

HOST_TYPE_CONTROLLER = 'controller'
HOST_TYPE_COMPUTE = 'compute'
HOST_TYPE_STORAGE = 'storage'
HOST_TYPE_NETWORK = 'network'
HOST_TYPE_BAREMETAL = 'baremetal'

HOST_STATISTICS_SCENARIO_LICENSE = 'license'
